Managing
MIDI Thru
You can
connect a MIDI input device directly to a MIDI output device so that when the
input device receives an MIM_DATA
To achieve
the best possible performance with multiple outputs, an application can choose
to supply a special form of MIDI output driver, called a thru driver.
Although the system allows only one MIDI output device to be connected to a
MIDI input device, multiple MIDI output devices can be connected to a thru
driver. An application on such a system could connect the MIDI input device to
this thru device and connect the MIDI thru device to as many MIDI output
devices as needed. For more information about thru drivers, see the Windows
device-driver documentation.
Using Messages to Manage MIDI Recording
The following
messages can be sent to a window or thread callback procedure for managing MIDI
recording:
MM_MIM_CLOSE |
Sent when a
MIDI input device is closed by using the midiInClose |
MM_MIM_DATA |
Sent when a
complete MIDI message is received. (This message is used for all MIDI
messages except system-exclusive messages.) |
MM_MIM_ERROR |
Sent when
an invalid MIDI message is received. (This message is used for all MIDI
messages except system-exclusive messages.) |
MM_MIM_LONGDATA |
Sent when
either a complete MIDI system-exclusive message is received or when a buffer
has been filled with system-exclusive data. |
MM_MIM_LONGERROR |
Sent when
an invalid MIDI system-exclusive message is received. |
MM_MIM_MOREDATA |
Sent when
an application is not processing MIM_DATA |
MM_MIM_OPEN |
Sent when a
MIDI input device is opened by using the midiInOpen |
A wParam
parameter and an lParam parameter are associated with each of these
messages. The wParam parameter always specifies the handle of an open
MIDI device. The lParam parameter is unused for the MM_MIM_CLOSE
For the MM_MIM_LONGDATA
Using a Callback Function to Manage MIDI Recording
You can
define your own callback function to manage recording for MIDI input devices.
The callback function is documented as MidiInProc
The following
messages can be sent to the wMsg parameter of the MidiInProc callback
function:
MIM_CLOSE |
Sent when
the device is closed by using the midiInClose |
|
||
MIM_DATA |
Sent when a
complete MIDI message is received (this message is used for all MIDI messages
except system-exclusive messages). |
|
||
MIM_ERROR |
Sent when
an invalid MIDI message is received (this message is used for all MIDI
messages except system-exclusive messages). |
|
||
|
MIM_LONGDATA |
Sent when
either a complete MIDI system-exclusive message is received or when a buffer
has been filled with system-exclusive data. |
||
MIM_LONGERROR |
Sent when
an invalid MIDI system-exclusive message is received. |
|
||
MIM_MOREDATA |
Sent when
an application is not processing MIM_DATA |
|
||
MIM_OPEN |
Sent when
the MIDI input device is opened by using the midiInOpen |
|
||
These
messages are similar to those sent to window procedure functions, but the
parameters are different. A handle of the open MIDI device is passed as a
parameter to the callback function, along with the doubleword of instance data
that was passed by using midiInOpen.
For the MIM_LONGDATA
After the
device driver is finished with a data block, you can clean up and free the data
block.